//
//  GameScene.h
//  NinjaTurtle
//
//  Created by Nguyen Tri Chung on 1/7/15.
//
//

#ifndef __NinjaTurtle__GameScene__
#define __NinjaTurtle__GameScene__

#include <stdio.h>
#include "cocos2d.h"
#include "../model/model.h"
#include "../support/support.h"
#include "ControllerLayer.h"
#include "HintLayer.h"
#include "PauseLayer.h"

USING_NS_CC;

class GameScene : public Scene, public View {
protected:
    GameEventListener* gameEventListener;
    EventListenerTouchOneByOne* touchListener;
    EventListenerKeyboard* keyBoardListener;

    Layer* mapLayer;
    Layer* gameLayer;
    Menu* mainMenu;
    ControllerLayer* controllerLayer;
    HintLayer* hintLayer;
    PauseLayer* pauseLayer;
public:
    GameScene();
    virtual ~GameScene();
    void disposeComponents();
    void onExit();
    
    void inialize();
    void createLayers();
    void createLayersContent();
    void processEvent(GameEvent* event);
    virtual void update(float dt);
    
    bool onTouchBegan(Touch* touch, Event* event);
    void onTouchMoved(Touch* touch, Event* event);
    void onTouchEnded(Touch* touch, Event* event);
    void onTouchCancelled(Touch* touch, Event* event);
    
    void onKeyPress(EventKeyboard::KeyCode keyCode, Event* event);
    void onKeyRelease(EventKeyboard::KeyCode keyCode, Event* event);
    
    void addSpriteToLayer(Obj* object, Layer* layer, int index);
    void removeSprite(Obj* object);
    
    void onPauseButtonClick(Ref* sender);
    void onContinueButtonClick(Ref* sender);
    void onRestartButtonClick(Ref* sender);
    void onQuitButtonClick(Ref* sender);
};

#endif /* defined(__NinjaTurtle__GameScene__) */
